package com.traffic.fuwu.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.traffic.fuwu.dao.LineMapper;
import com.traffic.fuwu.mybatis.pojo.Line;
import com.traffic.fuwu.service.LineService;
@Service
public class LineServiceImpl implements LineService{
    @Autowired
    private LineMapper lineMapper;
	@Override
	public List<Line> getLineList(String lineCode, String lineName,
			String appKey, int startRow, int pageSize) {
		List<Line> sb = new ArrayList<>();
		try {
			sb=lineMapper.getLineList(lineCode, lineName, appKey, startRow, pageSize);
		} catch (Exception e) {
			e.printStackTrace();
		}
		if(sb != null && sb.size() != 0){
			return sb;	
		}
		return null;
		
	}

	@Override
	public int getLineCount(String lineCode, String lineName, String appKey) {
		int count = 0;
		try {
			count = lineMapper.getLineCount(lineCode, lineName, appKey);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return count;
	}

	@Override
	public void addLine(Line line) {
		lineMapper.insert(line);
	}

	@Override
	public void updateLine(Line line) {
		lineMapper.updateByPrimaryKey(line);
	}

}
